import { computed } from 'vue';
import store from '@/store'

export function useBtnAuth() {


    // 所有菜单
    const btnAuthMap = computed(() => {
        return store.getters['user/userBtnPermission'] || {};
    })

    // 返回当前操作列要显示多少操作按钮
    const getOpBtnLen = (btnList) => {
        let list = btnList.filter(item => btnAuthMap.value[item])
        // let list = btnList.map(item => {
        //     if(btnAuthMap[item]){
        //         return item;
        //     }
        // }) || [];
        return list.length;
    }


    return {
        btnAuthMap,
        getOpBtnLen
    }
}
